﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using QuickGraph;
using GraphSharp;
using GraphSharp.Controls;
using System.IO;
using PI_CS_Library.PicsNetwork_Information_Model;

namespace PI_CS_GUI
{
    public partial class PhysicalTopologyViewer : UserControl
    {
        private Topology _network;
        TopologyLayout graphLayout;

        public PhysicalTopologyViewer()
        {

            InitializeComponent();

        }

        public void Init(PicsNetwork _network)
        {
            this._network = new Topology();
            MapNetworkInformation(_network);
            LoadGraphics();
        }

        private void MapNetworkInformation(PicsNetwork _network)
        {
            foreach (PicsMatrix _node in _network.MatrixResourceList.Values)
            {
                Topology.Node _newNode = new Topology.Node(_node);
                this._network.AddVertex(_newNode);
            }

            foreach (PicsLink _link in _network.LinkResourceList.Values)
            {
                Topology.Node _source = this._network._nodes[_link.SrcMatrix.Id.Number];
                Topology.Node _sink = this._network._nodes[_link.SinkMatrix.Id.Number];

                Topology.Link _newLink = new Topology.Link(_source, _sink, _link.Parameters.Capacity);
                this._network.AddEdge(_newLink);
            }
        }

        public void LoadGraphics()
        {
 
        }

    }
}
